// 以下是通过自动读取 pages.json 作为路由表的方式，了解更多请参照 自动构建路由表
// https://hhyang.cn/v2/tutorial/rgRoutes.html#%E5%AE%89%E8%A3%85

//vue.config.js
const TransformPages = require('uni-read-pages')
const { webpack } = new TransformPages()
module.exports = {
  transpileDependencies: ['uview-ui'],
  configureWebpack: {
    plugins: [
      new webpack.DefinePlugin({
        ROUTES: webpack.DefinePlugin.runtimeValue(() => {
          const tfPages = new TransformPages({
            includes: ['path', 'name', 'aliasPath']
          })
          return JSON.stringify(tfPages.routes)
        }, true)
      })
    ],
    module: {
    rules: [
      {
        test: /\.vue$/,
        use:{
            loader: "vue-inset-loader"
            // // 针对Hbuilder工具创建的uni-app项目
            // loader: path.resolve(__dirname,"./node_modules/vue-inset-loader")
        }
      }
    ]
},
  }
}
